import {initRequest} from "../request"

const globalSetting: any = {
    /**
     * 代理地址
     */
    proxyUrl: "",
    /**
     * 图片地址
     */
    fileUrl: "",
    /**
     * 高德地图key
     */
    mapKey:""
}

/**
 * 初始化请求
 */
const initGlobalSetting = (globalSettingConfig: any) => {
    for (const key in globalSettingConfig) {
        if (globalSettingConfig.hasOwnProperty(key)) {
            globalSetting[key] = globalSettingConfig[key] ?? ""
        }
    }
    initFunction()
}

/**
 * 执行方法
 */
const initFunction = () => {
    initRequest(globalSetting.proxyUrl)
}

export {
    initGlobalSetting,
    globalSetting
}